Skip to content

Conversation

@arnoox
Copy link
Contributor

@arnoox arnoox commented Feb 6, 2026

📌 Description

  • Add sn_schemas.py which translates metamodel.yaml into a schemas.json file consumable by sphinx-needs 6. This enables schema-based validation at parse time: required fields, regex patterns on option values, mandatory link presence (minItems: 1), and mandatory link target type checks (validate.network).
  • Because ubCode (the VS Code extension for sphinx-needs) evaluates these schemas during editing, all metamodel violations now surface as IDE diagnostics directly in the editor -- errors are caught early with lightweight, fast rendering, without waiting for a full Sphinx build.
  • Add comprehensive unit tests (test_sn_schemas.py) and integration tests (test_sn_schemas_integration.py) that validate generated schemas against the real S-CORE metamodel using jsonschema_rs, the same engine sphinx-needs uses at runtime.
  • Fix regex patterns in metamodel.yaml (\d -> [0-9]) for JSON Schema compatibility. TODO: really?
  • Add developer documentation (README.md) covering the two validation layers (schema vs. post-build Python checks) with a detailed coverage comparison table.

🚨 Impact Analysis

  • This change does not violate any tool requirements and is covered by existing tool requirements
  • This change does not violate any design decisions
  • Otherwise I have created a ticket for new tool qualification

✅ Checklist

  • Added/updated documentation for new or changed features
  • Added/updated tests to cover the changes
  • Followed project coding standards and guidelines

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //src:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.3.0) and connecting to it...
INFO: Invocation ID: 9833172e-5685-47be-94b5-58d477fe0876
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: src
Loading: 0 packages loaded
    currently loading: src
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //src:license-check (57 packages loaded, 9 targets configured)

Analyzing: target //src:license-check (69 packages loaded, 9 targets configured)

Analyzing: target //src:license-check (76 packages loaded, 9 targets configured)

Analyzing: target //src:license-check (126 packages loaded, 859 targets configured)

Analyzing: target //src:license-check (129 packages loaded, 2225 targets configured)

Analyzing: target //src:license-check (140 packages loaded, 2574 targets configured)

Analyzing: target //src:license-check (140 packages loaded, 2576 targets configured)

Analyzing: target //src:license-check (140 packages loaded, 2576 targets configured)

INFO: Analyzed target //src:license-check (145 packages loaded, 4715 targets configured).
[1 / 1] no actions running
[13 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox
[15 / 16] Building src/license.check.license_check.jar (); 0s disk-cache, multiplex-worker
INFO: Found 1 target...
Target //src:license.check.license_check up-to-date:
  bazel-bin/src/license.check.license_check
  bazel-bin/src/license.check.license_check.jar
INFO: Elapsed time: 24.169s, Critical Path: 2.51s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/src/license.check.license_check src/formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

The created documentation from the pull request is available at: docu-html

Copy link
Contributor

@ubmarco ubmarco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing a test for this. Ideally the generated schema.json is tested against the same SCORE metamodel tests. Then we can be sure the migration was successful.

# req-Id: tool_req__docs_common_attr_status
status: ^(valid|draft)$
content: ^[\s\S]+$
content: ^(.|[\n\r])+$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check whether these regexes make any trouble in SN6.
Maybe they work in jsonschema-rs. I changed those before we did the migration from jsonschema to jsonschema-rs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-introduced the original regex string, which runs as expected.

Schema structure per need type (sphinx-needs schema format):
- ``select`` : matches needs by their ``type`` field
- ``validate.local`` : validates the need's own properties (patterns, required)
- ``validate.network`` : validates properties of linked needs (NOT YET ACTIVE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is network not yet active? Is that a thing for another PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Just feared this is too big. Looking into it right now. Change size seems to be acceptable, so I'll include it in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@arnoox
Copy link
Contributor Author

arnoox commented Feb 9, 2026

Thanks for the review!

I'm missing a test for this. Ideally the generated schema.json is tested against the same SCORE metamodel tests. Then we can be sure the migration was successful.

Yeah this was still work in progress. I introduced a refactored/more testable version of the sn_schemas transformation, including unit/integration tests.

# req-Id: tool_req__docs_req_attr_validity_correctness
valid_from: ^v(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?$
valid_until: ^v(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?$
valid_from: ^v(0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))?$
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if the original regex are still working. If yes: revert.

@arnoox
Copy link
Contributor Author

arnoox commented Feb 11, 2026

The schema validation caught a new error in the score repo. We first need to fix it: eclipse-score/score#2581

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Draft

Development

Successfully merging this pull request may close these issues.

2 participants